﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.IO;

namespace SalaryChannel.Web
{
    public sealed class LogManager
    {
        private static object lockOjbect = new object();
        private LogManager()
        {

        }

        public static void Write(string message)
        {
            lock (lockOjbect)
            {
                try
                {
                    TextWriter textWriter = new StreamWriter(HttpContext.Current.Server.MapPath(@"./App_data/log.txt"), true);
                    textWriter.WriteLine("************************************");
                    textWriter.WriteLine(DateTime.Now.ToString());
                    textWriter.WriteLine(message);
                    textWriter.Flush();
                    textWriter.Close();
                }
                catch (Exception)
                {
                }
            }
        }
    }
}
